#!/usr/bin/perl -w

use strict;
use warnings;
use MyApp::Schema;

sub do_connect {
    return my $schema = MyApp::Schema->connect('dbi:SQLite:mmorpg_db1.db');
}

sub get_character_by_region {
    my ($region) = @_;
    my $s = do_connect();
    my @chars = $s->resultset("CharacterT")->search( {reg_name => $region} );

    return \@chars;
    
}

sub print_rs {
    my ($collection) = @_;

    foreach my $item (@{$collection}) {
	my @cols = $item->get_column();
	foreach my $col (@cols) {
	    print $item->$col;
	}

    }
}

#sub print_table {
#    my ($t_name) = @_;
#    my $schema = do_connect;
#    my @all = $schema->resulset("$t_name")->all;
#
#    # loop over table rows
#    foreach my $item in (@ll) {
#    }
#}

get_character_by_region("region_test0");
